import { MessageType } from '@/config';

// 获取产品的标题
export interface GetProductTitleOptions {
  name: string;
  advantage: string[];
  keyWord: string;
}
export async function getProductTitle(options: GetProductTitleOptions) {
  const titleResult = await browser.runtime.sendMessage({
    type: MessageType.generatorProductTitle,
    data: {
      getProductTitleOptions: options,
    },
  });
  console.log('GigaProductInfo', titleResult);
  if (titleResult.code === 0) {
    return titleResult.data;
  } else {
    throw new Error(`${titleResult.msg}`);
  }
}
